package com.ndp.fb.enums.adsetstatus;

import lombok.Getter;

/**
 * Created by Sisi on 14-9-19.
 */
@Getter
public enum AdSetStatus {
    /**
     *ACTIVE
     */
    ACTIVE ("ACTIVE", 1),

    /**
     * PAUSED
     */
    PAUSED("PAUSED", 2),

    /**
     *ARCHIVED
     */
    ARCHIVED("ARCHIVED", 3),

    /**
     * CAMPAIGN_GROUP_PAUSED
     */
    CAMPAIGN_GROUP_PAUSED("CAMPAIGN_GROUP_PAUSED", 4),

    /**
     *DELETED
     */
    DELETED("DELETED", 5);

    /**
     *status
     */
    private String status;

    /**
     *code
     */
    private int code;

    /**
     * AdSetStaus
     * @param status status
     * @param code code
     */
    private AdSetStatus(String status, int code){
        this.status = status;
        this.code = code;
    }

    /**
     * 根据code获取Status
     * @param code code
     * @return Status
     */
    public static AdSetStatus getStatus(int code) {
        for (AdSetStatus c : AdSetStatus.values()) {
            if (c.code == code) {
                return c;
            }
        }
        return null;
    }

    /**
     * 根据status获取Status
     * @param status status
     * @return Status
     */
    public static AdSetStatus getStatus(String status) {
        for (AdSetStatus c : AdSetStatus.values()) {
            if (c.status.equals(status)) {
                return c;
            }
        }
        return null;
    }

}
